package com.example.web.helper;

import com.example.web.service.DemoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * <p>
 *  异步的帮助类
 * </p>
 *
 * @author 12071
 * @date 2022/8/15 15:36
 */
@Slf4j
@Component
public class DemoHelper implements InitializingBean {

    // TODO: 2022/8/15 在帮助类中注入需要的Bean (ApiTemplate 中无法注入)

    @Resource
    private DemoService demoService;

    private static DemoHelper instance;

    public static DemoHelper INSTANCE() {
        return instance;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        instance = this;
    }

    // TODO: 2022/8/15 提供帮助类方法

    public void help(){
        log.info("helper: i can help");
    }
}
